package by.dvrudenko.avtobaza.datamodel;

import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import by.dvrudenko.avtobaza.datamodel.enums.FuelType;


@Entity
public class Car implements java.io.Serializable {
	
	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;
	
	@NotNull	
	@ManyToOne(fetch = FetchType.EAGER, targetEntity = CarType.class)
	private CarType carType;
	
	@Column
	@NotNull
	private Timestamp year;
	
	@Column
	@NotNull
	private Boolean carCondition;
	
	@Column
	@NotNull
	private Boolean work;
	
	@Column
	private String image;
	
	@Column	
	@Min(value = 0)
	@Max(value = 100)
	@NotNull
	private Integer carryingCapacity;
	
	@Column
	@Min(value = 0)
	@Max(value = 100)	
	@NotNull
	private Integer volumeCapacity;
	
	@Column
	@NotNull
	@Enumerated (EnumType.STRING)
	private FuelType fuelType; 

	@Column
	@Min(value = 0)
	@NotNull
	@Max(value = 50)	
	private Integer numberOfSeats;
	
	@Column
	@Min(value = 0)
	@NotNull
	@Max(value = 50)		
	private Integer bodyLength;
	
	@Column
	@Min(value = 0)
	@NotNull
	@Max(value = 50)		
	private Integer bodyWidth;
	
	@Column
	@NotNull
	@Size(min =2 , max = 12)
	private String carNumber; 

	public String getCarNumber() {
		return carNumber;
	}

	public void setCarNumber(String carNumber) {
		this.carNumber = carNumber;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public CarType getCarType() {
		return carType;
	}

	public void setCarType(CarType carType) {
		this.carType = carType;
	}

	public Timestamp getYear() {
		return year;
	}

	public void setYear(Timestamp year) {
		this.year = year;
	}

	public Boolean getCarCondition() {
		return carCondition;
	}

	public void setCarCondition(Boolean carCondition) {
		this.carCondition = carCondition;
	}

	public Boolean getWork() {
		return work;
	}

	public void setWork(Boolean work) {
		this.work = work;
	}

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public Integer getCarryingCapacity() {
		return carryingCapacity;
	}

	public void setCarryingCapacity(Integer carryingCapacity) {
		this.carryingCapacity = carryingCapacity;
	}

	public Integer getVolumeCapacity() {
		return volumeCapacity;
	}

	public void setVolumeCapacity(Integer volumeCapacity) {
		this.volumeCapacity = volumeCapacity;
	}

	public FuelType getFuelType() {
		return fuelType;
	}

	public void setFuelType(FuelType fuelType) {
		this.fuelType = fuelType;
	}

	public Integer getNumberOfSeats() {
		return numberOfSeats;
	}

	public void setNumberOfSeats(Integer numberOfSeats) {
		this.numberOfSeats = numberOfSeats;
	}

	public Integer getBodyLength() {
		return bodyLength;
	}

	public void setBodyLength(Integer bodyLength) {
		this.bodyLength = bodyLength;
	}

	public Integer getBodyWidth() {
		return bodyWidth;
	}

	public void setBodyWidth(Integer bodyWidth) {
		this.bodyWidth = bodyWidth;
	}
	
	
	
	
}